<?php

if (!isset($_SESSION['logged']))
    print "<script language='javascript'>
        window.location.href='./?url=404';
        </script>";
else {
    $iduser = $_SESSION['id'];
    $idfile = $_GET['file'];

    $sql = "INSERT INTO `user_file` (`user_id`, `file_id`) VALUES ('$iduser', '$idfile');";
    $result = mysql_query($sql, $link);

    print "<script language='javascript'>
        window.location.href='./';
        </script>";
}
?>

